package com.qf.mapper;

import com.qf.pojo.Account;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface AccountMapper {

    @Select("select * from account where id=#{id}")
    Account findById(Integer id);

    @Select("select * from account")
    List<Account> findAll();

    @Update("update account set money=#{money},name=#{name} where id=#{id}")
    int update(Account account);

    @Select("select * from account where uid=#{uid}")
    List<Account> findByUid(int uid);

    @Select("select * from account where name=#{name}")
    Account findByName(String name);

    @Update("update account set money=money+#{money} where name=#{name}")
    void updateMoneyByName(@Param("name") String name, @Param("money") Double money);

    @Insert("insert into account values (#{id},#{name},#{money},#{uid})")
    int insert(Account account);

    @Delete("delete from account where id=#{id}")
    int deleteById(Integer id);
}
